<template>
  <div class="header">
    <div class="l-content">
      <el-button
        plain
        icon="el-icon-menu"
        size="mini"
        @click="handelMenu"
      ></el-button>
      <!-- <h3 style="color: #fff">首页</h3> -->
      <el-breadcrumb separator="/">
        <el-breadcrumb-item class="breadColor" v-for="item in tags" :key="item.path" :to="{path:item.path}">{{item.label}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="r-content">
      <el-dropdown trigger="click" szie="mini">
        <span class="user">
          <img :src="userImg" />
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>个人中心</el-dropdown-item>
          <el-dropdown-item @click.native="logOut">退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
import { mapState,mapMutations } from 'vuex';
export default {
  name: "CommonHeader",
  data() {
    return {
      userImg: require("@/assets/images/user.png"),
    };
  },
  computed: {
    ...mapState({
      tags : state => state.tab.tabsList
    })
  },
  methods: {
    ...mapMutations(['clearToken','clearMenu']),
    handelMenu() {
      this.$store.commit("collapseMenu");
    },
    logOut(){
      console.log('g')
      this.clearToken()
      this.clearMenu()
      this.$router.push('/login')
    }
  },
};
</script>

<style lang="less" scoped>
.header {
  display: flex;
  height: 100%;
  justify-content: space-between;
  align-items: center;
  .l-content {
    display: flex;
    align-items: center;
    .el-button {
      margin-right: 20px;
    }
  }
  .r-content {
    width: 40px;
    height: 40px;
  }
  img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }
}
.el-dropdown-link {
  cursor: pointer;
  color: #409eff;
}
.el-icon-arrow-down {
  font-size: 12px;
}


.breadColor /deep/ .el-breadcrumb__inner {
  color: #686666;
  &:hover{
    color: #fff;
  }
}
</style>
